<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="top">
        View Item
    </ui:define>

    <ui:define name="left">
    </ui:define>



    <ui:define name="body">
        <h:panelGrid columns="2">
       
        <h:form>
            <h:panelGrid columns="2" border="1">
                <h:outputLabel for="name" value="Name:"/>
                <h:outputText id="name" value="#{itemCTRL.item.name}"/>
                
                <h:outputLabel for="manufacturer" value="Manufacturer:"/>
                <h:outputText id="manufacturer" value="#{itemCTRL.item.manufacturer}"/>
                
                <h:outputLabel for="stock" value="Stock:"/>
                <h:outputText id="stock" value="#{itemCTRL.item.stock}"/>
                
                <h:outputLabel for="price" value="Price:"/>
                <h:outputText id="price" value="#{itemCTRL.item.price}"/>
                
                <h:outputLabel value="Description:"/>
                <h:outputText value="#{itemCTRL.item.descrip}"/>
                
                <c:forEach items="#{itemCTRL.item.attributeValues}" var="items">
                    <h:outputLabel value="#{items.attribute.name}"/>
                    <h:outputText value="#{items.value}"/>
                </c:forEach>
            </h:panelGrid>
            <h:commandButton value="Delete" action="#{itemCTRL.deleteItem}" onclick="return confirm('Do you really want to delete this item?')"/>
            <h:commandButton value="Update Stock" action="#{itemCTRL.updateStockPrep}"/>
            <h:commandButton value="Update Item" action="#{itemCTRL.updateItem}"/>
        </h:form>
            
             <h:graphicImage width="320" height="240" url="/image/items/#{itemCTRL.item.id}.jpg"/>
        </h:panelGrid>
    </ui:define>

</ui:composition>
